define(function(require, exports, module) {
    'use strict';
    
    var rk = require('rk');
    require('../../su/xsySuRefer/widget');

    $.widget('rk.xsyCampaignRefer', $.rk.xsySuRefer, {
        options: {
            iconClass: 'xsy_su_refer_account_icon',
            business: 'campaign',
            createAct: 'createCampaign'
        },
        _create: function(){
            var me = this;
            var elem = me.element;
            var opt = me.options;
            me._super();
            me._reload();
        },
        _reload: function(){
            var me = this;
            var elem = me.element;
            var opt = me.options;

            var fromBelongId = opt.parentEntityId;
            var fromDataId = me._getDetailId();
            var fromItemId = opt.referItemId;

            var config = {
                iconClass: opt.iconClass,
                linkOfFinal: '/final/campaign.action?id={{id}}',
                linkOfMore: '/campaign.action?fromBelongId=' + fromBelongId + "&fromDataId=" + fromDataId + "&fromItemId=" + fromItemId,
                children: [
                    {
                        type: 'card'
                    },
                    {
                        type: 'grid'
                    }
                ],
                isFold: true
            };

            var param = {};
            me._loadData(param, function (result){
                /*if(me.data_bound){
                    me.bindData(result.self);
                }else{
                    me._render(config, result);
                }*/
                 me._render(config, result);
            });
        }
    });
});